.class public Lde/dealdoktor/app/views/LoaderImageView;
.super Landroid/widget/LinearLayout;
.source "LoaderImageView.java"


# static fields
.field private static final COMPLETE:I = 0x0

.field private static final FAILED:I = 0x1


# instance fields
.field private final imageLoadedHandler:Landroid/os/Handler;

.field private mContext:Landroid/content/Context;

.field private mDrawable:Landroid/graphics/drawable/Drawable;

.field private mImage:Landroid/widget/ImageView;

.field private mSpinner:Landroid/widget/ProgressBar;


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 4
    .parameter "context"
    .parameter "attrSet"

    .prologue
    const/4 v3, 0x0

    .line 42
    invoke-direct {p0, p1, p2}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 113
    new-instance v1, Landroid/os/Handler;

    new-instance v2, Lde/dealdoktor/app/views/LoaderImageView$1;

    invoke-direct {v2, p0}, Lde/dealdoktor/app/views/LoaderImageView$1;-><init>(Lde/dealdoktor/app/views/LoaderImageView;)V

    invoke-direct {v1, v2}, Landroid/os/Handler;-><init>(Landroid/os/Handler$Callback;)V

    iput-object v1, p0, Lde/dealdoktor/app/views/LoaderImageView;->imageLoadedHandler:Landroid/os/Handler;

    .line 43
    const-string v1, "image"

    invoke-interface {p2, v3, v1}, Landroid/util/AttributeSet;->getAttributeValue(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 44
    .local v0, url:Ljava/lang/String;
    if-eqz v0, :cond_0

    .line 45
    invoke-direct {p0, p1, v0}, Lde/dealdoktor/app/views/LoaderImageView;->instantiate(Landroid/content/Context;Ljava/lang/String;)V

    .line 49
    :goto_0
    return-void

    .line 47
    :cond_0
    invoke-direct {p0, p1, v3}, Lde/dealdoktor/app/views/LoaderImageView;->instantiate(Landroid/content/Context;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;)V
    .locals 2
    .parameter "context"
    .parameter "imageUrl"

    .prologue
    .line 59
    invoke-direct {p0, p1}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;)V

    .line 113
    new-instance v0, Landroid/os/Handler;

    new-instance v1, Lde/dealdoktor/app/views/LoaderImageView$1;

    invoke-direct {v1, p0}, Lde/dealdoktor/app/views/LoaderImageView$1;-><init>(Lde/dealdoktor/app/views/LoaderImageView;)V

    invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Handler$Callback;)V

    iput-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->imageLoadedHandler:Landroid/os/Handler;

    .line 60
    invoke-direct {p0, p1, p2}, Lde/dealdoktor/app/views/LoaderImageView;->instantiate(Landroid/content/Context;Ljava/lang/String;)V

    .line 61
    return-void
.end method

.method static synthetic access$0(Lde/dealdoktor/app/views/LoaderImageView;)Landroid/widget/ImageView;
    .locals 1
    .parameter

    .prologue
    .line 30
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mImage:Landroid/widget/ImageView;

    return-object v0
.end method

.method static synthetic access$1(Lde/dealdoktor/app/views/LoaderImageView;)Landroid/graphics/drawable/Drawable;
    .locals 1
    .parameter

    .prologue
    .line 28
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mDrawable:Landroid/graphics/drawable/Drawable;

    return-object v0
.end method

.method static synthetic access$2(Lde/dealdoktor/app/views/LoaderImageView;)Landroid/widget/ProgressBar;
    .locals 1
    .parameter

    .prologue
    .line 29
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mSpinner:Landroid/widget/ProgressBar;

    return-object v0
.end method

.method static synthetic access$3(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/net/MalformedURLException;
        }
    .end annotation

    .prologue
    .line 138
    invoke-static {p0}, Lde/dealdoktor/app/views/LoaderImageView;->getDrawableFromUrl(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$4(Lde/dealdoktor/app/views/LoaderImageView;Landroid/graphics/drawable/Drawable;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 28
    iput-object p1, p0, Lde/dealdoktor/app/views/LoaderImageView;->mDrawable:Landroid/graphics/drawable/Drawable;

    return-void
.end method

.method static synthetic access$5(Lde/dealdoktor/app/views/LoaderImageView;)Landroid/os/Handler;
    .locals 1
    .parameter

    .prologue
    .line 113
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->imageLoadedHandler:Landroid/os/Handler;

    return-object v0
.end method

.method private static getDrawableFromUrl(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 2
    .parameter "url"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/net/MalformedURLException;
        }
    .end annotation

    .prologue
    .line 139
    new-instance v0, Ljava/net/URL;

    invoke-direct {v0, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/net/URL;->getContent()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/io/InputStream;

    const-string v1, "name"

    invoke-static {v0, v1}, Landroid/graphics/drawable/Drawable;->createFromStream(Ljava/io/InputStream;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    return-object v0
.end method

.method private instantiate(Landroid/content/Context;Ljava/lang/String;)V
    .locals 3
    .parameter "context"
    .parameter "imageUrl"

    .prologue
    const/4 v2, -0x2

    .line 69
    iput-object p1, p0, Lde/dealdoktor/app/views/LoaderImageView;->mContext:Landroid/content/Context;

    .line 71
    new-instance v0, Landroid/widget/ImageView;

    iget-object v1, p0, Lde/dealdoktor/app/views/LoaderImageView;->mContext:Landroid/content/Context;

    invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mImage:Landroid/widget/ImageView;

    .line 72
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mImage:Landroid/widget/ImageView;

    new-instance v1, Landroid/widget/LinearLayout$LayoutParams;

    invoke-direct {v1, v2, v2}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 74
    new-instance v0, Landroid/widget/ProgressBar;

    iget-object v1, p0, Lde/dealdoktor/app/views/LoaderImageView;->mContext:Landroid/content/Context;

    invoke-direct {v0, v1}, Landroid/widget/ProgressBar;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mSpinner:Landroid/widget/ProgressBar;

    .line 75
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mSpinner:Landroid/widget/ProgressBar;

    new-instance v1, Landroid/widget/LinearLayout$LayoutParams;

    invoke-direct {v1, v2, v2}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    invoke-virtual {v0, v1}, Landroid/widget/ProgressBar;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 77
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mSpinner:Landroid/widget/ProgressBar;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/widget/ProgressBar;->setIndeterminate(Z)V

    .line 79
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mSpinner:Landroid/widget/ProgressBar;

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/views/LoaderImageView;->addView(Landroid/view/View;)V

    .line 80
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mImage:Landroid/widget/ImageView;

    invoke-virtual {p0, v0}, Lde/dealdoktor/app/views/LoaderImageView;->addView(Landroid/view/View;)V

    .line 82
    if-eqz p2, :cond_0

    .line 83
    invoke-virtual {p0, p2}, Lde/dealdoktor/app/views/LoaderImageView;->setImageDrawable(Ljava/lang/String;)V

    .line 85
    :cond_0
    return-void
.end method


# virtual methods
.method public setImageDrawable(Ljava/lang/String;)V
    .locals 2
    .parameter "imageUrl"

    .prologue
    .line 93
    const/4 v0, 0x0

    iput-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mDrawable:Landroid/graphics/drawable/Drawable;

    .line 94
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mSpinner:Landroid/widget/ProgressBar;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/ProgressBar;->setVisibility(I)V

    .line 95
    iget-object v0, p0, Lde/dealdoktor/app/views/LoaderImageView;->mImage:Landroid/widget/ImageView;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 96
    new-instance v0, Lde/dealdoktor/app/views/LoaderImageView$2;

    invoke-direct {v0, p0, p1}, Lde/dealdoktor/app/views/LoaderImageView$2;-><init>(Lde/dealdoktor/app/views/LoaderImageView;Ljava/lang/String;)V

    .line 107
    invoke-virtual {v0}, Lde/dealdoktor/app/views/LoaderImageView$2;->start()V

    .line 108
    return-void
.end method
